pub fn goldbach_conjecture() -> u64 {
    let mut first_ans = None;

    // 奇合数
    let mut num: u64 = 1;
    // 记录比num小的所有奇素数
    let mut primes = vec![];
    loop {
        num += 2;
        if is_prime(num) {
            // 记录奇素数
            primes.push(num);
            continue;
        }

        let mut flag = false;
        for prime_num in primes.iter() {
            let sq = (num - prime_num) / 2;
            if is_perfect_square(sq) {
                flag = true;
                break;
            }
        }

        if flag {
            continue;
        }

        // 不能被写成...的数
        match first_ans {
            None => {
                first_ans = Some(num);
            }
            Some(n) => {
                return n + num;
            }
        }
    }
}

/// 判断是否为素数
fn is_prime(num: u64) -> bool {
    let bound = (num as f64).sqrt() as u64;
    for i in 2..=bound {
        if num % i == 0 {
            return false;
        }
    }
    return true;
}

/// 判断是否为完全平方数
fn is_perfect_square(num: u64) -> bool {
    let root = (num as f64).sqrt() as u64;
    root * root == num
}
